package com.sql;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: MySQLService.proto")
public final class MySQLServiceGrpc {

  private MySQLServiceGrpc() {}

  public static final String SERVICE_NAME = "com.mysql.grpc.MySQLService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getExecuteSQLMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.sql.SQLRequest,
      com.sql.SQLResponse> METHOD_EXECUTE_SQL = getExecuteSQLMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.sql.SQLRequest,
      com.sql.SQLResponse> getExecuteSQLMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.sql.SQLRequest,
      com.sql.SQLResponse> getExecuteSQLMethod() {
    return getExecuteSQLMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.sql.SQLRequest,
      com.sql.SQLResponse> getExecuteSQLMethodHelper() {
    io.grpc.MethodDescriptor<com.sql.SQLRequest, com.sql.SQLResponse> getExecuteSQLMethod;
    if ((getExecuteSQLMethod = MySQLServiceGrpc.getExecuteSQLMethod) == null) {
      synchronized (MySQLServiceGrpc.class) {
        if ((getExecuteSQLMethod = MySQLServiceGrpc.getExecuteSQLMethod) == null) {
          MySQLServiceGrpc.getExecuteSQLMethod = getExecuteSQLMethod = 
              io.grpc.MethodDescriptor.<com.sql.SQLRequest, com.sql.SQLResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "com.mysql.grpc.MySQLService", "executeSQL"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.sql.SQLRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.sql.SQLResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new MySQLServiceMethodDescriptorSupplier("executeSQL"))
                  .build();
          }
        }
     }
     return getExecuteSQLMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static MySQLServiceStub newStub(io.grpc.Channel channel) {
    return new MySQLServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static MySQLServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new MySQLServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static MySQLServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new MySQLServiceFutureStub(channel);
  }

  /**
   */
  public static abstract class MySQLServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void executeSQL(com.sql.SQLRequest request,
        io.grpc.stub.StreamObserver<com.sql.SQLResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getExecuteSQLMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getExecuteSQLMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.sql.SQLRequest,
                com.sql.SQLResponse>(
                  this, METHODID_EXECUTE_SQL)))
          .build();
    }
  }

  /**
   */
  public static final class MySQLServiceStub extends io.grpc.stub.AbstractStub<MySQLServiceStub> {
    private MySQLServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private MySQLServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected MySQLServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new MySQLServiceStub(channel, callOptions);
    }

    /**
     */
    public void executeSQL(com.sql.SQLRequest request,
        io.grpc.stub.StreamObserver<com.sql.SQLResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getExecuteSQLMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class MySQLServiceBlockingStub extends io.grpc.stub.AbstractStub<MySQLServiceBlockingStub> {
    private MySQLServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private MySQLServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected MySQLServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new MySQLServiceBlockingStub(channel, callOptions);
    }

    /**
     */
    public com.sql.SQLResponse executeSQL(com.sql.SQLRequest request) {
      return blockingUnaryCall(
          getChannel(), getExecuteSQLMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class MySQLServiceFutureStub extends io.grpc.stub.AbstractStub<MySQLServiceFutureStub> {
    private MySQLServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private MySQLServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected MySQLServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new MySQLServiceFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.sql.SQLResponse> executeSQL(
        com.sql.SQLRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getExecuteSQLMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_EXECUTE_SQL = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final MySQLServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(MySQLServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_EXECUTE_SQL:
          serviceImpl.executeSQL((com.sql.SQLRequest) request,
              (io.grpc.stub.StreamObserver<com.sql.SQLResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class MySQLServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    MySQLServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.sql.MySQLServiceProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("MySQLService");
    }
  }

  private static final class MySQLServiceFileDescriptorSupplier
      extends MySQLServiceBaseDescriptorSupplier {
    MySQLServiceFileDescriptorSupplier() {}
  }

  private static final class MySQLServiceMethodDescriptorSupplier
      extends MySQLServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    MySQLServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (MySQLServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new MySQLServiceFileDescriptorSupplier())
              .addMethod(getExecuteSQLMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
